import 'package:go_router/go_router.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import '../../pages/index.dart';
import 'routerNames.dart';

// 全局路由器
final appRouter = GoRouter(
  initialLocation: RouteNames.main,
  debugLogDiagnostics: true,
  routes: routes,
  observers: [FlutterSmartDialog.observer],
);

// 路由列表
final List<RouteBase> routes = [
  GoRoute(path: RouteNames.main, builder: (context, state) => const MainPage()),
  GoRoute(
    path: RouteNames.login,
    builder: (context, state) => const LoginPage(),
  ),
  GoRoute(
    path: RouteNames.register,
    builder: (context, state) => const RegisterPage(),
  ),
  GoRoute(path: RouteNames.home, builder: (context, state) => const HomePage()),
  GoRoute(
    path: RouteNames.community,
    builder: (context, state) => const CommunityPage(),
  ),
  GoRoute(path: RouteNames.mine, builder: (context, state) => const MinePage()),
  GoRoute(
    path: RouteNames.myPlant,
    builder: (context, state) => const MyPlantPage(),
  ),
  GoRoute(
    path: RouteNames.postDetail,
    builder: (context, state) => const PostDetailPage(),
  ),
  GoRoute(
    path: RouteNames.release,
    builder: (context, state) => const ReleasePage(),
  ),
  GoRoute(
    path: RouteNames.plantDetail,
    builder: (context, state) => const PlantDetailPage(),
  ),
  GoRoute(
    path: RouteNames.addPlant,
    builder: (context, state) => const AddPlantPage(),
  ),
  GoRoute(path: RouteNames.ai, builder: (context, state) => AiPage()),
  GoRoute(path: RouteNames.chat, builder: (context, state) => const ChatPage()),
  GoRoute(
    path: RouteNames.chatList,
    builder: (context, state) => const ChatListPage(),
  ),
  GoRoute(
    path: RouteNames.setting,
    builder: (context, state) => const SettingPage(),
  ),
  GoRoute(
    path: RouteNames.others,
    builder: (context, state) => const OthersPage(),
  ),
  GoRoute(
    path: RouteNames.subscription,
    builder: (context, state) => const SubscriptionPage(),
  ),
];
